package com.monitor.web.controller;

import com.alibaba.fastjson.JSON;
import com.monitor.message.manager.RedisManager;
import com.monitor.message.model.RedisModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author tanlian
 * @Date 2018/9/26 16:23
 * @Desc
 */
@RestController
@RequestMapping("/redis")
public class RedisController {

    @Autowired
    private RedisManager redisManager;

    @RequestMapping("/insert")
    public String redisTest(){
        redisManager.insertObject("jedis", "test");
        return "success";
    }


    @RequestMapping(value = "/json")
    public RedisModel jsonTest(){
        RedisModel redisModel = new RedisModel();
        redisModel.setIdCard("522730199606180036");
        redisModel.setName("tanlian");
        redisModel.setAge(123);
        System.out.println(JSON.toJSONString(redisModel));
        return redisModel;
    }

}
